/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.einstein.job;

import com.mycompany.Sesion;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.LocalBean;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Stateless;
import javax.faces.context.FacesContext;
import javax.inject.Inject;

/**
 *
 * @author Tobe
 */
@Singleton
public class Job {

    public Job() {
    }
    
    @Inject
    Sesion sesion;
    
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    
    //@Schedule(second="*/1", minute="*",hour="*", persistent=false)
    //public void actualizarReloj(){
        
        //Date a = new Date();
        //sesion.setFecha_hora(dateFormat.format(a));
    //}
    
    
    @Schedule(second="*/1", minute="*",hour="*", persistent=false)
    public void doWork(){
        Date a = new Date();
        System.out.println(dateFormat.format(a) + "timer: " + sesion.getUsuario());
    }
    
}
